<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .main {
            width: 600px;
            height: 600px;
            border: 1px solid red;
            display: flex;
        }
        .main > div {
            width: 100px;
            height: 100px;
            border: solid;
        }
        /* 
            flex-grow 对于剩余空间的分配（存在剩余空间才有效）
            值是数字，默认值是0，不可以是负值
            将所有项目的 值 加起来做分母，每个项目的值做分子
        */
        .main > div:nth-child(1) {
            flex-grow: 1;
        }
        .main > div:nth-child(2) {
            flex-grow: 1;
        }
        .main > div:nth-child(3) {
            flex-grow: 2;
        }
        .main > div:nth-child(4) {
            flex-grow: 4;
        }
    </style>
</head>
<body>
    <div class="main">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
    </div>
</body>
</html>